﻿--HEADER Diary Entry Table
CREATE TABLE [iPerform].[DiaryEntry]
(
	[Id] INT NOT NULL IDENTITY , 
    [Name] NVARCHAR(MAX) NULL, 
    [Text] NVARCHAR(MAX) NULL, 
    [LastModified] DATETIME2 NOT NULL, 
    [Created] DATETIME2 NOT NULL, 
	[OwnerId] int not null,
    CONSTRAINT [PK_DiaryEntry] PRIMARY KEY ([Id])
)
GO
ALTER TABLE [iPerform].[DiaryEntry] 
ADD CONSTRAINT [FK_DiaryEntry_User] FOREIGN KEY (OwnerId) REFERENCES [Membership].[User](Id);